package com.xuzz.study.spring.scanner;

import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.context.annotation.ClassPathBeanDefinitionScanner;
import org.springframework.core.type.filter.AnnotationTypeFilter;

import java.lang.annotation.Annotation;

/**
 * @description:
 * @author: xuzz
 * @create: 2020-02-28 10:42
 */
public class MyClassPathDefinitonScanner extends ClassPathBeanDefinitionScanner {
    public MyClassPathDefinitonScanner(BeanDefinitionRegistry registry){
        super(registry,true);
        //super(registry,false);  //标识不用默认的扫描，也就是@Component 这些注解不扫描
    }
    /**
     * 注册 过滤器
     */
    public void registerTypeFilter( Class<? extends Annotation> annotationType){
        addIncludeFilter(new AnnotationTypeFilter(annotationType));
    }
}